package ymqtt

import "sync"

type Conf struct {
	ClientID    string
	Password    string
	UserName    string `json:"userName,omitempty"`
	Dns         string `json:"dns,default=tcp://127.0.0.1:1883"`
	KeepAlive   int    `json:"keepAlive,default=60"`
	PingTimeout int    `json:"pingTimeout,default=1"`
}

type operate struct {
	lock sync.Mutex
}

func (o *operate) Lock(fn func()) {
	o.lock.Lock()
	defer o.lock.Unlock()
	fn()
}
